package com.ipet.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ipet.system.pojo.SysUser;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SysUserMapper extends BaseMapper<SysUser> {
    @Select("select * from tb_sys_user where username = #{username}")
    @Results({
            @Result(id = true , property = "id" , column = "id"),
            @Result(property = "roleList" , column = "id" , javaType = List.class,
            many = @Many(select = "com.ipet.system.mapper.SysRoleMapper.findByUId"))
    })
    SysUser findByUsername(String username);
}
